//
//  UIViewController+SetupEmpty.m
//  YiGuo
//
//  Created by sam lau on 17/4/24.
//  Copyright © 2017年 sam lau. All rights reserved.
//

#import "UIViewController+SetupEmpty.h"
#import "EmptyView.h"
#import "NetWorkProblemView.h"

@implementation UIViewController (SetupEmpty)


//#pragma mark - 添加上下拉刷新
//- (void)setupRefreshView:(UITableView *)tableView {
//    
//    /**
//     *  下拉
//     */
//    MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
//    // 设置文字
//    [header setTitle:@"刷  新" forState:MJRefreshStateIdle];
//    [header setTitle:@"刷 新" forState:MJRefreshStatePulling];
//    [header setTitle:@"刷  新" forState:MJRefreshStateRefreshing];
//    // 设置字体
//    header.stateLabel.font = CHINESE_PingFangRegular(14);
//    header.lastUpdatedTimeLabel.font = CHINESE_PingFangRegular(14);
//    // 设置颜色
//    header.stateLabel.textColor = samColor;
//    header.lastUpdatedTimeLabel.textColor = samColor;
//    
//    //header.stateLabel.hidden = YES;// 隐藏状态文字
//    header.lastUpdatedTimeLabel.hidden = YES;//隐藏时间
//    
//    tableView.mj_header = header;
//    header.automaticallyChangeAlpha = YES;
//    
//    
//    /**
//     *  上拉
//     */
//    //MJRefreshAutoNormalFooter *footerView = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
//    MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
//    footer.automaticallyHidden = YES;
//    
//    // 设置字体
//    footer.stateLabel.font = CHINESE_PingFangRegular(14);
//    // 设置颜色
//    footer.stateLabel.textColor = samColor;
//    //隐藏状态文字
//    //footer.stateLabel.hidden = YES;
//    
//    tableView.mj_footer = footer;
//    //[footer endRefreshingWithNoMoreData];//已经全部加载完毕
//    
//}
//
//-(void)setupEmpty:(UITableView *)tableView{
//    tableView.emptyDataSetSource = self;
//    tableView.emptyDataSetDelegate = self;
////    [self imageForEmptyDataSet:tableView];
////    [self titleForEmptyDataSet:tableView];
//    [self backgroundColorForEmptyDataSet:tableView];
//    [self emptyDataSetShouldAllowScroll:tableView];
//    [self customViewForEmptyDataSet:tableView];
//}
////-(void)setupNetProblem:(UITableView *)tableView{
////    
////    tableView.emptyDataSetSource = self;
////    tableView.emptyDataSetDelegate = self;
////    samEmpty = 1;
////    //    [self imageForEmptyDataSet:tableView];
////    //    [self titleForEmptyDataSet:tableView];
////    [self backgroundColorForEmptyDataSet:tableView];
////    [self emptyDataSetShouldAllowScroll:tableView];
////    [self customViewForEmptyDataSet:tableView];
////
////    
////}
//
//#pragma mark - 空白页
////- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
////{
////    UIImage *image = [UIImage imageNamed:@"noData"];
////    //UIImage *image1 = [UIImage imageNamed:@"loading_imgBlue_78x78"];
////    return image;
////}
////- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
////{
////    NSString *text = @"没有数据";
////    
////    NSDictionary *attributes = @{NSFontAttributeName: CHINESE_PingFangRegular(18),
////                                 NSForegroundColorAttributeName: [UIColor darkGrayColor]};
////    
////    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
////}
//
//- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
//{
//    return [UIColor whiteColor];
//}
//
//- (UIView *)customViewForEmptyDataSet:(UIScrollView *)scrollView
//{
//    UIView *emptyView = [EmptyView shareInstance];
//    emptyView.frame = scrollView.bounds;
//    return emptyView;
//    //UIView *problemView = [[NetWorkProblemView alloc]initWithFrame:scrollView.bounds];
//    
////    if (samEmpty == 0) {
////        return emptyView;
////    }else{
////        return problemView;
////    }
//
//}
//
//#pragma mark - delegate
//- (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView
//{
//    return YES;
//}
//- (BOOL)emptyDataSetShouldDisplay:(UIScrollView *)scrollView{
//    
//    return YES;
//    
//}


@end
